<html>
<head><meta charset="utf-8"><title>owo_colors · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html">owo_colors</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="227409060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227409060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227409060">(Feb 23 2021 at 10:30)</a>:</h4>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/issues/4544#issuecomment-783540264">this</a> is an ... interesting problem. I'm inclined to say that creating such huge extension traits implemented for almost all types should maybe be discouraged; but maybe we also need to provide some way (attribute) of 'fixing' this in existing cases. I'm not a fan of any setting that requires listing specific traits or functions. I wonder what other people think about this though.</p>



<a name="227409265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227409265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227409265">(Feb 23 2021 at 10:32)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="220273">@Jane Lusby</span></p>



<a name="227409366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227409366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227409366">(Feb 23 2021 at 10:33)</a>:</h4>
<p>I think the problem might lie in <code>color-eyre</code> re-exporting <code>owo</code>?</p>



<a name="227409503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227409503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227409503">(Feb 23 2021 at 10:34)</a>:</h4>
<p>Ie, I think blanket extensions are fine, as long as the user opts-in into using them.</p>



<a name="227409695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227409695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227409695">(Feb 23 2021 at 10:37)</a>:</h4>
<p>But yeah, it's hard to say what's the ideal behavior here. Not suggesting to flyimport the trait would be wrong, I think.</p>
<p>I guess, once we have a scoring system in place, we can score <code>impl&lt;T&gt; Trait for T</code> really low</p>



<a name="227410381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227410381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227410381">(Feb 23 2021 at 10:43)</a>:</h4>
<p>I think even a user opting into owo_colors would probably not want to see the extension methods on every completion</p>



<a name="227410476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227410476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227410476">(Feb 23 2021 at 10:44)</a>:</h4>
<p>also, I don't even think this is just about flyimport -- even if you've <code>use</code>d the trait it'd get pretty annoying in the whole file</p>



<a name="227410708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227410708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227410708">(Feb 23 2021 at 10:46)</a>:</h4>
<p>This feels like an inherent tradeoff to me you will be annoyed by seeing methods everywhere, but you also will be annoyed by <em>not</em> seeing the method where you want to.</p>



<a name="227410733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227410733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227410733">(Feb 23 2021 at 10:46)</a>:</h4>
<p>or I mean, a user using owo_colors would want to see the methods in some situations (inside println) but not in most others, but of course the problem is that we can't really magically know which situations that are</p>



<a name="227410742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227410742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227410742">(Feb 23 2021 at 10:46)</a>:</h4>
<p>yeah</p>



<a name="227410745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227410745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227410745">(Feb 23 2021 at 10:46)</a>:</h4>
<p>Yeah, exactly</p>



<a name="227410824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227410824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227410824">(Feb 23 2021 at 10:47)</a>:</h4>
<p>An interesting lib-design approach here is to provide just one universal extension: <code>foo.colorize().beige()</code></p>



<a name="227410978"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227410978" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227410978">(Feb 23 2021 at 10:48)</a>:</h4>
<p>I am 60% sure that proper scoring (or at least scoring at all) would solve 70% of the problems here...</p>



<a name="227410979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227410979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227410979">(Feb 23 2021 at 10:48)</a>:</h4>
<p>yeah, that seems like a better approach</p>



<a name="227411072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227411072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227411072">(Feb 23 2021 at 10:49)</a>:</h4>
<p>and that's kind of what I mean by discouraging that kind of extension traits, but it of course doesn't help with the existing crate</p>



<a name="227411151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227411151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227411151">(Feb 23 2021 at 10:50)</a>:</h4>
<p>although I guess the crate could introduce that and mark the existing methods as <code>doc(hidden)</code></p>



<a name="227411211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227411211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227411211">(Feb 23 2021 at 10:50)</a>:</h4>
<p>... or a new ide-specific attribute to hide them from completion</p>



<a name="227411751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227411751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227411751">(Feb 23 2021 at 10:55)</a>:</h4>
<p>it might be nice if the completions for these methods only started showing up once you've typed three letters from it</p>



<a name="227412745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227412745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227412745">(Feb 23 2021 at 11:03)</a>:</h4>
<p>but you're probably right and better ranking would mostly solve this</p>



<a name="227412998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/owo_colors/near/227412998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/owo_colors.html#227412998">(Feb 23 2021 at 11:05)</a>:</h4>
<p>but I actually like the attribute idea -- we can use an attribute to control ranking. Llike <code>#[completion(unlikely)]</code>. Though it seems more robust to just infer those based on usages.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>